import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        redirect: '/home',
    },

    {
        path: '/home',
        name: 'home',
        component: Home,
    },
    {
        path: '/free',
        name: 'free',

        component: () => import(/* webpackChunkName: "about" */ '../views/Free.vue'),
    },
    {
        path: '/goods',
        name: 'goods',

        component: () => import(/* webpackChunkName: "about" */ '../views/Goods.vue'),
    },
    {
        path: '/user',
        name: 'user',

        component: () => import(/* webpackChunkName: "about" */ '../views/User.vue'),
    },
    {
        path: '/order',
        name: 'order',

        component: () => import(/* webpackChunkName: "about" */ '../views/Order.vue'),
    },
];

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
});
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
    return originalPush.call(this, location).catch(err => {});
};

export default router;
